<template>
  <div class="h-full">
    <markdown-editor v-model:value="content"></markdown-editor>
  </div>
</template>
<script setup lang="ts">
const { $lc, _route } = useNuxtApp()
const { data } = await useLazyAsyncData('data', () =>
  $lc
    .one('Article', (q) => {
      q.equalTo('objectId', _route.params.id)
      return q
    })
    .then((res) => {
      if (!res) return {
        title: '文章不存在',
        keywords: '',
        description: ''
      }
      return res.toJSON()
    })
    .catch((err) => {
      console.log(err)
    })
)
const content = ref('')
content.value = `### 111`
useHead({
  title: data.value.title,
  meta: [
    { name: 'keywords', content: '前端心转手,博客' },
    { name: 'keywords', content: data.value.keywords },
    { name: 'description', content: data.value.description }
  ]
})
</script>
